//高德小程序SDK
var amapFile = require('amap-wx.js');
/***************
 * 此处为高德地图小程序的key
 ****************/
var map = new amapFile.AMapWX({
    key: '高德地图小程序的key'
});
var watcher = true;

//公共模块
module.exports = {
    //实例化高德地图
    map: map,
    //授权地理位置
    getLocation: function(callback) {
        wx.getLocation({
            type: 'gcj02',
            success: function() {
                if (callback) {
                    callback();
                }
            },
            fail: function() {
                wx.getSetting({
                    success: function(res) {
                        if (!res.authSetting['scope.userInfo'] || !res.authSetting['scope.userLocation']) {
                            wx.openSetting();
                        }
                    }
                });
            }
        })
    }
}